package com.example.demo;

import java.util.ArrayList;
import java.util.Properties;
import java.util.Random;

/**
 * @author liuhe
 * @date 2020/08/10
 */
public class GCDemo2 {

    public static void main(String[] args) throws InterruptedException {
        ArrayList<Object> objects = new ArrayList<>();
        while (true) {
            int sleep = new Random().nextInt(100);
            if (System.currentTimeMillis() % 2 == 0) {
                objects.clear();
            } else {
                for (int i = 0; i < 10000; i++) {
                    Properties properties = new Properties();
                    properties.put("key_" + i, "value_" + System.currentTimeMillis() + "_" + i);
                    objects.add(properties);
                }
            }
            Thread.sleep(sleep);
        }
    }
}
